;
(function () {

  'use strict';

  angular.module('directives.customActivity')
    .directive('summaryHealthMaxLayout', summaryHealthMaxLayout)
    .directive('summaryHealthMinLayout', summaryHealthMinLayout)
    .directive('summaryHealthAvgLayout', summaryHealthAvgLayout);

  function summaryHealthMaxLayout(summaryHealthMaxService) {

    return {
      restrict: 'E',
      scope: true,
      template: '<div layoutdom="1" draggable="true" class="model" module-name="summary-health-max-layout">' +
      '<label class="title title-color2">健康度(最高值)</label>' +
      '<div class="jk-title" ng-class="{\'green\':health.sumHealthState===\'优\',\'blue\':health.sumHealthState===\'良\',\'yellow\':health.sumHealthState===\'中\',\'red\':health.sumHealthState===\'差\'}"><div class="jk-one">{{health.sumHealthState}}</div><div class="jk-two">{{health.sumHealth | currency:\'\'}}%</div></div>' +
      '<div style="width: 100%; height: 160px; margin-top: 8px;"></div>' +
        //'<div style="text-align: center; margin-top: -20px;">最高值</div>' +
      '<core-loading ng-hide="health.loading"></core-loading>' +
      '</div>',
      replace: true,
      link: function (scope, element) {
        scope.health = summaryHealthMaxService;
        summaryHealthMaxService.init(element.find('div')[3]);
      }
    }
  }

  summaryHealthMaxLayout.$inject = ['summaryHealthMaxService'];

  function summaryHealthMinLayout(summaryHealthMinService) {

    return {
      restrict: 'E',
      scope: true,
      template: '<div layoutdom="1" draggable="true" class="model" module-name="summary-health-min-layout">' +
      '<label class="title title-color2">健康度(最低值)</label>' +
      '<div class="jk-title" ng-class="{\'green\':health.sumHealthState===\'优\',\'blue\':health.sumHealthState===\'良\',\'yellow\':health.sumHealthState===\'中\',\'red\':health.sumHealthState===\'差\'}"><div class="jk-one">{{health.sumHealthState}}</div><div class="jk-two">{{health.sumHealth | currency:\'\'}}%</div></div>' +
      '<div style="width: 100%; height: 160px; margin-top: 8px;"></div>' +
        //'<div style="text-align: center; margin-top: -20px;">最低值</div>' +
      '<core-loading ng-hide="health.loading"></core-loading>' +
      '</div>',
      replace: true,
      link: function (scope, element) {
        scope.health = summaryHealthMinService;
        summaryHealthMinService.init(element.find('div')[3]);
      }
    }
  }

  summaryHealthMinLayout.$inject = ['summaryHealthMinService'];

  function summaryHealthAvgLayout(summaryHealthAvgService) {

    return {
      restrict: 'E',
      template: '<div layoutdom="1" draggable="true" class="model" module-name="summary-health-avg-layout">' +
      '<label class="title title-color2">健康度(平均值)</label>' +
      '<div class="jk-title" ng-class="{\'green\':health.sumHealthState===\'优\',\'blue\':health.sumHealthState===\'良\',\'yellow\':health.sumHealthState===\'中\',\'red\':health.sumHealthState===\'差\'}"><div class="jk-one">{{health.sumHealthState}}</div><div class="jk-two">{{health.sumHealth | currency:\'\'}}%</div></div>' +
      '<div style="width: 100%; height: 160px; margin-top: 8px;"></div>' +
        //'<div style="text-align: center; margin-top: -20px;">平均值</div>' +
      '<core-loading ng-hide="health.loading"></core-loading>' +
      '</div>',
      replace: true,
      scope: true,
      link: function (scope, element) {
        scope.health = summaryHealthAvgService;
        summaryHealthAvgService.init(element.find('div')[3]);
      }
    }
  }

  summaryHealthAvgLayout.$inject = ['summaryHealthAvgService'];
})();